From d696494d9bb04f3a8fef0ad33773731ffc92a571 Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Fri, 9 Mar 2007 11:45:19 +0000 Subject: [PATCH] [SVM] Don't free HSA and root vmcb when disabling SVM since we're no longer allowed to free pages in an interrupt context. Signed-off-by: Tim Deegan --- xen/arch/x86/hvm/svm/svm.c | 22 ++++++---------------- xen/arch/x86/hvm/svm/vmcb.c | 5 ----- xen/include/asm-x86/hvm/svm/vmcb.h | 1 - 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 61380c606a..0766ca5de2 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -107,22 +107,10 @@ static inline void svm_inject_exception(struct vcpu *v, int trap, static void stop_svm(void) { u32 eax, edx; - int cpu = smp_processor_id(); - /* We turn off the EFER_SVME bit. */ rdmsr(MSR_EFER, eax, edx); eax &= ~EFER_SVME; wrmsr(MSR_EFER, eax, edx); - - /* release the HSA */ - free_host_save_area(hsa[cpu]); - hsa[cpu] = NULL; - wrmsr(MSR_K8_VM_HSAVE_PA, 0, 0 ); - - /* free up the root vmcb */ - free_vmcb(root_vmcb[cpu]); - root_vmcb[cpu] = NULL; - root_vmcb_pa[cpu] = 0; } static void svm_store_cpu_guest_regs( @@ -1058,8 +1046,9 @@ int start_svm(void) return 0; } - if (!(hsa[cpu] = alloc_host_save_area())) - return 0; + if (!hsa[cpu]) + if (!(hsa[cpu] = alloc_host_save_area())) + return 0; rdmsr(MSR_EFER, eax, edx); eax |= EFER_SVME; @@ -1074,8 +1063,9 @@ int start_svm(void) phys_hsa_hi = (u32) (phys_hsa >> 32); wrmsr(MSR_K8_VM_HSAVE_PA, phys_hsa_lo, phys_hsa_hi); - if (!(root_vmcb[cpu] = alloc_vmcb())) - return 0; + if (!root_vmcb[cpu]) + if (!(root_vmcb[cpu] = alloc_vmcb())) + return 0; root_vmcb_pa[cpu] = virt_to_maddr(root_vmcb[cpu]); if (cpu == 0) diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index f2a220011e..1d9c1569c3 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -79,11 +79,6 @@ struct host_save_area *alloc_host_save_area(void) return hsa; } -void free_host_save_area(struct host_save_area *hsa) -{ - free_xenheap_page(hsa); -} - static int construct_vmcb(struct vcpu *v) { struct arch_svm_struct *arch_svm = &v->arch.hvm_svm; diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h index 8551e8a479..9dff3e65af 100644 --- a/xen/include/asm-x86/hvm/svm/vmcb.h +++ b/xen/include/asm-x86/hvm/svm/vmcb.h @@ -460,7 +460,6 @@ struct arch_svm_struct { struct vmcb_struct *alloc_vmcb(void); struct host_save_area *alloc_host_save_area(void); void free_vmcb(struct vmcb_struct *vmcb); -void free_host_save_area(struct host_save_area *hsa); int svm_create_vmcb(struct vcpu *v); void svm_destroy_vmcb(struct vcpu *v); -- 2.30.2